package com.oceansoft.mobile.common.util;

import org.apache.commons.lang.StringUtils;

public final class ValidateCardUtils {

	// 1:男 2:女
	public static String validateSex(String card) {
		String sex = null;
		if (StringUtils.isNotBlank(card)
				&& (card.length() == 15 || card.length() == 18)) {

			String flag = card.substring(card.length()-2, card.length()-1);
			int flagInt = Integer.parseInt(flag);
			if(flagInt %2 == 0){
				sex = "2";
			}else{
				sex = "1";
			}
		}
		return sex;
	}

}
